<template>
  <van-tree-select
    :items="items"
    :main-active-index="mainActiveIndex"
    :active-id="activeId"
    @navclick="onNavClick"
    @itemclick="onItemClick"
  />
</template>

<script>
import Vue from 'vue'
import { TreeSelect } from 'vant'
Vue.use(TreeSelect)
export default {
  data () {
    return {
      items: [],
      // 左侧高亮元素的index
      mainActiveIndex: 0,
      // 被选中元素的id
      activeId: 1
    }
  },
  methods: {
    onNavClick (index) {
      this.mainActiveIndex = index
    },
    onItemClick (data) {
      this.activeId = data.id
    }
  }
}
</script>

<style scoped>

</style>
